<%--
    Document   : newfood
    Created on : Nov 11, 2011, 10:24:21 AM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model, Models.TienTe_Model"%>
<script type="text/javascript">
        function keypress(e){
            //Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
            var keypressed = null;
            if (window.event)
            {
                keypressed = window.event.keyCode; //IE
            }
            else
            {
                keypressed = e.which; //NON-IE, Standard
            }
            if (keypressed < 48 || keypressed > 57 )
            { //CharCode của 0 là 48 (Theo bảng mã ASCII)
                //CharCode của 9 là 57 (Theo bảng mã ASCII)
                if (keypressed == 8 || keypressed == 127 || keypressed == 46 )
                {//Phím Delete và Phím Back
                    return;
                }
                return false;
            }
        }
</script>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'newfood', 'addmore', 'choosefile', 'save', 'rightmsg', 'chktientemsg', 'notice', 'checkunitmsg', 'checksubmitmsg', 'foodgroups', 'foodname', 'abbreviation', 'description', 'image', 'unit', 'price' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.

            String abbreviation = mdsts[0].getTenTS();   
            String addmore = mdsts[1].getTenTS();
            String checksubmitmsg = mdsts[2].getTenTS();
            String checkunitmsg = mdsts[3].getTenTS();
            String chktientemsg = mdsts[4].getTenTS();
            String choosefile = mdsts[5].getTenTS();
            String description = mdsts[6].getTenTS();
            String foodgroups = mdsts[7].getTenTS();
            String foodname = mdsts[8].getTenTS();
            String image = mdsts[9].getTenTS();
            String newfood = mdsts[10].getTenTS();
            String notice = mdsts[11].getTenTS();
            String price = mdsts[12].getTenTS();
            String rightmsg = mdsts[13].getTenTS();
            String save = mdsts[14].getTenTS();
            String unit = mdsts[15].getTenTS();

            String msgright = notice + "/" + rightmsg;
            
            String msgsubmit = notice + "/" + checksubmitmsg;
            String msgcheckunit = notice + "/" + checkunitmsg;
            String msgcheckcurrency = notice + "/" + chktientemsg;
            
            Vector vDSNMA = (Vector) request.getAttribute("DSNMA");


%>

<div >
    <div class="title">
        <%=newfood%>
        
    </div>
    <div class="content">
        <form name="addFood" class="<%=msgsubmit %>" id="<%=msgcheckcurrency %>" dir="<%=msgright%>"  lang="<%=msgcheckunit %>" onsubmit="return CheckSubmit(this.className, this.lang, this.id, this.dir)" action="../MonAn_Controller?action=Add" enctype="multipart/form-data" method="post">
            <div style=" float: left; width: 62%; margin-left: 20px; margin-top: 15px; margin-bottom: 15px;">
            <div style="width: 110px; float: left; margin-left: 5px; "><label><%=foodgroups %></label></div>
            <select name="nhommonan" style=" width: 200px; margin-bottom: 15px;">
                <%
                            for (int k = 0; k < vDSNMA.size(); k++) {
                                Beans.NhomMA nma = (Beans.NhomMA) vDSNMA.elementAt(k);
                %>       <option value="<%=nma.getMaNMA()%>"><%=nma.getTenNMA()%></option>
                <%  }
                %>
            </select><br />
            <div style="width: 110px; float: left; margin-left: 5px; "><label><%=foodname %></label></div>
            <input type="text" style=" width: 200px; margin-bottom: 15px;" class="text" name="tenmonan"/><br />
            <div style="width: 110px; float: left; margin-left: 5px; "><label><%=abbreviation %></label></div>
            <input type="text" style=" width: 200px; margin-bottom: 15px;" class="text" name="tenviettat"/><br />
            <div style="width: 110px; float: left; margin-left: 5px; "><label><%=description %></label></div>
            <textarea class="textarea" style=" margin-bottom: 15px;" cols="22" rows="2" name="mota"></textarea><br />
            <div style="width: 110px; float: left; margin-left: 5px; "><label><%=image %></label></div>
            <div id="uniform-file" class="uploader">
                <input id="imageUpload" type="file" size="15" name="Image" id="Image" onchange="Upload(this.value)" style="opacity: 0; ">
                <span class="filename" style="-moz-user-select: none; margin-top: -24px; color: #131313; max-width: 180px;"></span>
                <span class="action" style="-moz-user-select: none;"><%=choosefile%></span>
            </div><br />
            <input type="submit" class="button" style=" margin-left: 115px; margin-top: 20px; margin-bottom: 5px;" value="<%=save%>">
            </div>            
            <table style=" width: 36%; margin-top: 15px;" >
                <thead>
                    <tr>
                        <th style="width: 35%; border: none; background: none; padding-bottom: 15px;"><%=unit %></th>
                        <th style="width: 50%; border: none; background: none; padding-bottom: 15px;"><%=price %>
                            <%  String kyhieu = TienTe_Model.LayKyHieuTT(langid); %>
                            <a href="#" style=" margin-left: 15px;" name="<%=kyhieu %>" id="<%=msgcheckunit %>" dir="<%=msgcheckcurrency %>" onclick="Addmoredvt(this.name, this.id, this.dir)"><%=addmore%></a>
                        </th>                        
                    </tr>
                </thead>
                <tbody id="dvt">
                    <tr>
                        <td style="border: none; background: none;">
                            <input type="text" style=" width: 100px; margin-bottom: 11px;" alt="<%=msgcheckunit %>" onchange="CheckDVT(this.value, this.alt)" class="text" name="donvitinh"/>
                        </td>
                        <td style="border: none; background: none;">
                           <input type="text" style=" width: 100px; margin-bottom: 11px;" alt="<%=msgcheckcurrency %>"  onkeypress="return keypress(event)" onchange="CheckTienTe(this.alt)" class="text" name="gia"/>
                           <%=TienTe_Model.LayKyHieuTT(langid) %>
                        </td>
                    </tr>
                <input type="hidden" id="checksubmit" value="true">
                <input type="hidden" id="checkcurrency" value="true">
                </tbody>
            </table>
        </form>
    </div>
</div>
<div id="foodlang" style=" width: 49%; overflow: hidden; " >
</div>